from flask import session, current_app, render_template  # current_app:flask 应用程序运行过程中，保存的一些配置信息
import logging      # 引入日志模块
from . import index_bp      # 导入蓝图
from info import redis_store  # 引入数据库
from info import models  # 引入表格
import pymysql

pymysql.install_as_MySQLdb()
"""
After this function is called, any application that imports MySQLdb or
_mysql will unwittingly actually use pymysql.
"""


# ImportError: cannot import name 'redis_store' 循环导入问题
"""使用蓝图"""
@index_bp.route('/')
def hello_world():
    print(current_app.url_map)
    return render_template("index.html")


@index_bp.route('/favicon.ico')
def favicon():
    """返回项目的图标"""
    # send_static_file 找到static文件夹下面的静态文件发送给浏览器显示
    return current_app.send_static_file("news/favicon.ico")
